/* Copyright 2010 by Matt Van Der Westhuizen */

package org.chaoticengine.ast.view;

import org.chaoticengine.ast.model.AirShip;
import org.chaoticengine.ast.model.Altitude;
import org.chaoticengine.ast.pattern.ViewController;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author Matt Van Der Westhuizen <mattpwest@gmail.com>
 */
public class AirShipDetailsView extends ViewController<AirShip> {
    protected AirShip ship = null;
    protected String name = null;
    protected Altitude alt = Altitude.GROUND;

    @Override
    public AirShip getModel() {
        return(ship);
    }

    @Override
    public void keyPressed(int key, char c) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyReleased(int key, char c) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseClick(int x, int y, int button) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseEnter() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseExit() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseMove(int oldx, int oldy, int newx, int newy) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseRelease(int x, int y, int button) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseWheelDown() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onMouseWheelUp() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void refresh(AirShip model) {
        ship = model;

        this.name = ship.getName();
        this.alt = ship.getAltitude();
    }

    @Override
    public void render(GameContainer gc, StateBasedGame sbg, Graphics grphcs) throws SlickException {
        if (ship == null) {
            return;
        }

        grphcs.translate(position.x, position.y);
        grphcs.setColor(Color.white);
        int line = 1;
        grphcs.drawString(name, grphcs.getFont().getLineHeight(), grphcs.getFont().getLineHeight() * line++);
        grphcs.drawString("Altitude: " + alt, grphcs.getFont().getLineHeight(), grphcs.getFont().getLineHeight() * line++);

        grphcs.translate(-position.x, -position.y);
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sbg, int delta) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void onDeselect() {
    }

    @Override
    public void onSelect() {
    }
}
